<link type="text/css" href="<?php echo base_url("assets/css/chosen.css")?>" rel="stylesheet" />
<link rel="stylesheet" href="<?php echo base_url("assets/css/bootstrap-datetimepicker.min.css")?>">
<script src="<?php echo base_url("assets/js/bootstrap-datetimepicker.min.js")?>"></script>
<script type="text/javascript" src="<?php echo base_url("assets/js/chosen.js")?>"></script>
<div class="page-header">
	<h1> Bình luận <?php echo empty($model["title"])?"":$model["title"]?></h1>
</div>
<style type="text/css">

.active_select{display:block}
.hide_select{display:none}

</style>
<?php echo form_open_multipart($this->config->item('admin_folder').'/comment/form/'.$post["id"]); ?>
<div class="tabbable">
    <div class="tab-content">
    	<div class="form-actions"><button class="btn btn-primary">Lưu</button> <button class="btn btn-back">Trở về</button></div>
        <fieldset>
        	<div style="position:relative;margin-top:5px;">
                <label for="name">Sản phẩm</label>
                <?php echo form_dropdown("obj_id",$product,$post["obj_id"],"class='span12 chosen' id='title'") ?>
        	</div>
            <?php if(!empty($post["table"])){?>
            	<?php if($post["table"] == "customers"){?>
                <div style="position:relative;margin-top:5px">
                    <label for> Danh sách khàng hàng</label>    
                    <?php echo form_dropdown("customer_id",$customer,$post["customer_id"],"class='span12 chosen' id='title'") ?>
                </div>
                <?php }else{?>
                <div style="position:relative;margin-top:5px">
                    <label for> Danh sách khàng hàng</label>    
                    <?php echo form_dropdown("customer_id",$email_recieve,$post["customer_id"],"class='span12 chosen' id='title'") ?>
                </div>
                <?php }?>
            <?php }else{?>
           		<div style="position:relative;margin-top:5px">
            		<input type="radio" name="table" checked="checked" value="customers" /> Khách hàng <input type="radio" name="table" value="email_receive_news" />Email nhận tin
                    <div class="active_select" id="customers_abc"><?php echo form_dropdown("customers",$customer,$post["customer_id"],"class='span12  customers chosen' id='title'") ?></div>
                    <div class="hide_select" id="email_receive_news_abc"><?php echo form_dropdown("email_receive_news",$email_recieve,$post["customer_id"],"class='span12 email_receive_news chosen' id='title'") ?></div>
                </div>
                <div class="list_customer"></div>
            <?php }?>
            <div style="position:relative;margin-top:5px">
                <label>Ngày nhập bình luận</label>
<div id="datepicker_abc" class="input-append date">
                <input data-format="dd/MM/yyyy hh:mm:ss" type="text" value="<?php echo ($post["created"])?date("d/m/Y H:i:s",$post["created"]):""?>" name="created"></input>
                <span class="add-on">
                  <i data-time-icon="icon-time" data-date-icon="icon-calendar">
                  </i>
                </span>
            </div>
            </div>
            <label> Điểm số (chỉ nhập điểm từ 1 -> 5) </label>
            <input type="text" name="score" value="<?php echo $post["score"]?>">
            <label> Nhập bình luận</label>
            <textarea name="content" style="width:98%;height:100px"><?php echo $post["content"] ?></textarea>
        </fieldset>

        <div class="form-actions"><button class="btn btn-primary">Lưu</button> <button class="btn btn-back">Trở về</button></div>
    </div>
</div>
<script language="javascript">

$().ready(function(){
	
	$("input[name='table']").change(function(){
		$(".chosen-container.chosen-container-single").css("width","100%");
		$(".active_select").addClass("hide_select").removeClass("active_select");
		$("#"+$(this).val()+"_abc").addClass("active_select").removeClass("hide_select");
	});
});

$(".chosen").chosen();
$("#datepicker_abc").datetimepicker({
 pick12HourFormat: true
});
$(".btn-back").click(function(){
	window.location="<?php echo site_url("admin/comment/index/".$page)?>";
	return false;
});
</script>